﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zj.OpenAuth.Domain.Core;

namespace Zj.OpenAuth.Repository.Models.Mapping
{
    /// <summary>
    /// use role mapping fluent api maping
    /// </summary>
    public class UserRoleMappingMap
        : EntityTypeConfiguration<UserRoleMapping>
    {
        public UserRoleMappingMap()
        {
            //table
            ToTable("UserRoleMapping", "dbo");



            //keys
            HasKey(t => t.Id);



            //properties
            this.Property(t => t.Id)
                .HasColumnName("Id")
                .IsRequired();

            this.Property(t => t.UserId)
                .HasColumnName("UserId")
                .IsRequired();

            this.Property(t => t.RoleId)
                 .HasColumnName("RoleId")
                 .IsRequired();

        }
    }
}
